package m.jclecai.com.adapter;

import android.content.Context;
import android.view.ViewGroup;

import java.util.List;

import m.jclecai.com.R;
import m.jclecai.com.adapter.base.ViewHolerAdapter;
import m.jclecai.com.adapter.holder.RedPkgHolder;
import m.jclecai.com.bean.RedPacketBean;

/**
 * Created by ZD on 2017/6/27.
 */

public class RedPkgAdapter extends ViewHolerAdapter<RedPkgHolder> {

    List<RedPacketBean> redPcks;
    Context context;
    int flag = 0;

    public RedPkgAdapter(List<RedPacketBean> redPcks, Context context,int flag) {
        this.redPcks = redPcks;
        this.context = context;
        this.flag = flag;
    }

    @Override
    public RedPkgHolder onCreateViewHolder(int position, ViewGroup parent) {
        return new RedPkgHolder(context, R.layout.item_regpkg);
    }

    @Override
    public void onBindViewHolder(int position, RedPkgHolder redPkgHolder) {
        RedPacketBean pkg = redPcks.get(position);
        redPkgHolder.init(pkg,flag);
    }

    @Override
    public int getCount() {
        return redPcks.size();
    }
}
